/*
 * Project: jcerticles
 * Copyright(c) 2011 jcerticles
 * All rights reserved.
 *
 * $Revision $, last modified $Date $ by $Author $
 */
package com.quintilis31.home.core.content.util;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;

import com.quintilis31.home.common.repository.content.Answer;
import com.quintilis31.home.common.repository.content.Question;

/**
 * TODO... Write javadoc...
 * @author jothi
 * @since  1.6
 */
public class ExamObject implements Serializable {
	
	/* Initialize an ExamObject through the getInstance method */
	public ExamObject() {}
	
	/* The unique serial version identifier */
	private static final long serialVersionUID = 1L;
	
	/* All the questions for a given Exam */
	private SortedMap < Question, List < Answer > > questionBank;
	
	/* The List of all the questions answered by the user */
	private Map < Long, List < Long > > answeredQuestionsWithAnswers;
	
	/* The current question that is being shown to the user */
	private Question currentQuestion;
	
	/* The Answers for the current question */
	private List < Answer > currentAnswers;
	
	/* Flag to tell if the current question is already answered by the user */
	private boolean isCurrentQuestionAnswered;
	
	/* Flag to indicate that the user has scrolled through all the questions */
	private boolean isEndOfExam;
	
	/* Map to hold the questionId's of all the unanswered questions */
	private SortedMap < Long, Long > unansweredQuestionIdMap;
	
	/* Map to hold all the questionId's */
	private SortedMap < Long, Long > allQuestionIds;
	
	/* The current mapped questionId for navigation */
	private Long mappedQuestionId;
	
	/* The ExamResult */
	private ExamResult examResult;
		
	/**
	 * @return the examResult
	 */
	public ExamResult getExamResult() {
		return examResult;
	}

	/**
	 * @param examResult the examResult to set
	 */
	public void setExamResult(ExamResult examResult) {
		this.examResult = examResult;
	}

	/**
	 * @return the mappedQuestionId
	 */
	public Long getMappedQuestionId() {
		return mappedQuestionId;
	}

	/**
	 * @param mappedQuestionId the mappedQuestionId to set
	 */
	public void setMappedQuestionId(Long mappedQuestionId) {
		this.mappedQuestionId = mappedQuestionId;
	}

	/**
	 * @return the allQuestionIds
	 */
	public SortedMap < Long, Long > getAllQuestionIds() {
		return allQuestionIds;
	}

	/**
	 * @param allQuestionIds the allQuestionIds to set
	 */
	public void setAllQuestionIds(SortedMap < Long, Long > allQuestionIds) {
		this.allQuestionIds = allQuestionIds;
	}

	/**
	 * @return the unansweredQuestionIdMap
	 */
	public SortedMap < Long, Long > getUnansweredQuestionIdMap() {
		return unansweredQuestionIdMap;
	}

	/**
	 * @param unansweredQuestionIdMap the unansweredQuestionIdMap to set
	 */
	public void setUnansweredQuestionIdMap(
			SortedMap < Long, Long > unansweredQuestionIdMap) {
		this.unansweredQuestionIdMap = unansweredQuestionIdMap;
	}

	/**
	 * @return the isEndOfExam
	 */
	public boolean isEndOfExam() {
		return isEndOfExam;
	}

	/**
	 * @param isEndOfExam the isEndOfExam to set
	 */
	public void setEndOfExam(boolean isEndOfExam) {
		this.isEndOfExam = isEndOfExam;
	}

	/**
	 * @return the isCurrentQuestionAnswered
	 */
	public boolean isCurrentQuestionAnswered() {
		return isCurrentQuestionAnswered;
	}

	/**
	 * @param isCurrentQuestionAnswered the isCurrentQuestionAnswered to set
	 */
	public void setCurrentQuestionAnswered(boolean isCurrentQuestionAnswered) {
		this.isCurrentQuestionAnswered = isCurrentQuestionAnswered;
	}

	/**
	 * @return the currentQuestion
	 */
	public Question getCurrentQuestion() {
		return currentQuestion;
	}

	/**
	 * @param currentQuestion the currentQuestion to set
	 */
	public void setCurrentQuestion(Question currentQuestion) {
		this.currentQuestion = currentQuestion;
	}

	/**
	 * @return the currentAnswers
	 */
	public List<Answer> getCurrentAnswers() {
		return currentAnswers;
	}

	/**
	 * @param currentAnswers the currentAnswers to set
	 */
	public void setCurrentAnswers(List<Answer> currentAnswers) {
		this.currentAnswers = currentAnswers;
	}

	/**
	 * @return the questionBank
	 */
	public SortedMap < Question, List < Answer > > getQuestionBank() {
		return questionBank;
	}

	/**
	 * @param questionBank the questionBank to set
	 */
	public void setQuestionBank(SortedMap < Question, List < Answer > > questionBank) {
		this.questionBank = questionBank;
	}

	/**
	 * @return the answeredQuestionsWithAnswers
	 */
	public Map < Long, List < Long > > getAnsweredQuestionsWithAnswers() {
		return answeredQuestionsWithAnswers;
	}

	/**
	 * @param answeredQuestionsWithAnswers the answeredQuestionsWithAnswers to set
	 */
	public void setAnsweredQuestionsWithAnswers(
			Map < Long, List < Long > > answeredQuestionsWithAnswers) {
		this.answeredQuestionsWithAnswers = answeredQuestionsWithAnswers;
	}
	
	/**
	 * Fetch a new instance... TODO.. Later do some
	 * basic initialization stuff... like create date, time
	 * for logging purposes...
	 * @return
	 */
	public static ExamObject getInstance() {
		return new ExamObject();
	}
}